Your best bet here is something like this:
*label repeat01
You encounter a door with a lock.
*choice
#Open door (requires key)
*if has_key = true
You use the key and unlock the door.
*goto inside_door
*else
You do not have the key, so you are unable to unlock the door.
*goto repeat01
#leave
*goto repeat
*label inside_door
This would allow you to set up a simple locked door, where if the variable that checks if the player has the key is true, then they can enter the room. Hope this helps.
But i urge you to look at the welcome thread, as it contains a bunch of useful links and tutorials and the like.
https://forum.choiceofgames.com/t/welcome-to-the-choice-of-games-forum