See also lockable clothes.
If you have a penis, you can use it to lock your clothes on you (I just love this statement: “If you have a penis, you can use it … ;-D )
Put on any clothes with a built-in condom (e.g. latex pantyhose, a catsuit, shorts) or usual nylon/lycra pantyhose (you may want to add a swimsuit or a leotard) or zentai. If there is no built-in condom (or cock&ball sheath), stretch the material around you not-erected cock & balls and tie shoelace around the base of your penis behind the scrotum. Not too tight and make a simple easily undoable knot.
If there is no penis sheath (if you use, for example, usual pantyhose), you can curl your cock into a tight ball, so this technique will prevent erection. But you will also have to pee through the material or wait until the key is available (an additional bonus in some cases ;-)
To prevent pulling out, the ring must be as tight as possible, so measure carefully.
You may see a simplified example in the Lockable / Chastity Pantyhose forum thread.