Generally speaking, when the 'leg locks up' like you experienced, that is related to a problem inside or around the knee joint. Especially since the pain is still present, I would definitely recommend that you see your primary care doctor
about this issue to help figure out what is going on and whether or not you need any specific treatment.
"Locking up" of the knee can often be related to trouble with the gliding of the patella (knee cap) over the surface of the leg bones. This is commonly associated with a condition known as patellofemoral pain syndrome, or 'runner's knee', which is caused by overuse, strain, and an imbalance in the muscle groups of the leg. Locking up, catching, or 'giving out' of the knee may also be related to ligament injuries or weakness in the knee joint, most often due to prior severe injuries to the knee (such as old sports injuries).
Your doctor will be able to examine your knee and help figure out if there is any evidence of weakness or inflammation. Based on what they find, they can recommend anti inflammatory medications, physical therapy, or strengthening exercises. In more extreme cases, they may want addition imaging studies of the knee to further help define the problem.