Jaw clicks painfully and sticks like that (basically, a minor case of lockjaw). What should I do?

See your dentist. Sounds like you may have some displacement of the soft tissue internal jaw joint structures. You should consult with your dentist.
Acute painful click. First of all don't let it click again. Limit your range of motion with opening your mouth. Seek the attention of a dentist who is familiar with treating TMJ related symptoms and has access to a cbct scanner. A careful evaluation needs to be conducted to find the cause of the clicking. Ice the joint, if comfortable, in the first 10 hours and bring warm heat in the area after that. Ibuprofen.
See below. A 'locking' jaw is usually caused by the disc in the jaw joint becoming malpositioned. This can be caused by clenching or bruxism (grinding the teeth at night). When the jaw 'locks', it can be in an open position or a closed position. This is a temporomandibular joint disorder (tmj). This can be treated by a dentist (with oral appliances) who has the proper training and experience.
TMJ. Significant TMJ problem. Has potential to be a real problem. See a TMJ specialist. Any dentist can be a TMJ expert with the proper training and experience. Most commonly, oral surgeons, prosthodontists, and orofacial pain specialists. Ask your MD, your dentist and your dental society for referrals.