It's very specifically a Movement Step that needs to be spent, not an action. From the rulebook (pg. 8):
Unlike other cards in a room, Lock cards are revealed when an investigator attempts to move into the room. Before a player physically moves his investigator figure into the room, the keeper turns the Lock card faceup and reads it aloud to all players.
Additionally,
If the player is unable to discard the proper card or solve the puzzle, then he cannot enter the room this turn (and wasted this Movement Step). When a moving investigator encounters an ability saying “this door is locked,” his figure remains in its current room and cannot move for this Movement Step.
At the end of the section, it makes this very specific (my emphasis):
Lock cards are always resolved when an investigator attempts to enter the room...
In most situations, the Lock cards say "This door is locked" so you can't reattempt entering the room in the same turn. I guess you can move away from the door if you still have a Movement Step or Run Action remaining.