Create a profile Screen Locked triggered on the event Display Off and calling a task that sets a variable %SCREEN_LOCKED to true iff %SCREEN is off.
Create another profile Screen Unlocked triggered on the event Display Unlocked and calling a task that sets that variable%SCREEN_LOCKED to false.
If you'd like for a profile to be triggered (or not) if the screen is locked:
Create a third profile Display Locked triggered on the variable%SCREEN_LOCKED being true andand calling some NoOp task (which does pretty much nothing) then use the Profile Active trigger on the profile conditional on screen lock state.