This, along with the AGE of the beardie (you said "four months old"
suggests (and I forget the word for it) that happens when they ingest a food item/other, that is too large. Beardies up to about 4 or 5-months old can get things into their mouth that is slightly larger than their throat, subsequent swallowing therfore, impinges the item against the roof of mouth/back of neck, pinching nerves there that create 'spasms'. The spasms might last for a day or so.. then suddenly, the patient poops-out a stone, piece of inorganic material or carapactic wad from a superworm overdose or *something* that makes you go "OH!".
A warm soak in the bath tub might help them eliminate the item.
From age hatching to about maybe 4 or 5 months old, beardies are prone this. And not just from having eaten a single item that is slightly too large, but also can come from having eaten perfectly correct-sized items but in large quanties such as being permitted to eat several dozen crickets in one meal. 'Gorging'. -They can 'over-pack' themselves, although this tends to happen when feeding multiple juvies that are housed and fed in the same enclosure. -Feeling the competition for the resourses, juvie beardies will 'gulp their food' without chewing and also, over-indulge, causing this impaction.
The 'stiff leg spasm' is also statedly a calcium-related issue, but calcium deficiency takes many months to manifest itself and I personally feel it less likely to be seen in such a youthful beardie. If your patient were, say, a 2-year old female that just laid her third clutch of eggs this season, sure, I'd say "calcium deficiency" and believe it. But I am thinking what you're seeing is an impaction problem. If this the case, it will, um, pass. 
-Joel