Diagnosis
The steel locking pin in the stem is dry or misaligned. It needs lubrication.
How to Fix It
Apply grease to the pin. Fold the scooter. Pull the lock collar back to expose the shiny steel pin. Apply a small amount of bicycle grease or white lithium grease to the pin. Work the mechanism several times.
If That Didn't Work
The lock collar mechanism itself is bent or damaged. This requires a full stem hinge replacement. Do not try to bend it back.
Heads Up
A poorly latched stem can collapse while riding. Before every ride, visually confirm the red lock indicator is not visible and give the stem a strong shake test.