You would need to remember the state of the turnstile when someone attempts to go through it. If it's locked, you can't pass. If it's unlocked, you can.
Whether or not this situation needs a "state machine" is debatable, but you do need to remember the state. In this case, a simple boolean "isLocked" could suffice.