This could be because of muscle fatigue or dehydration. Try exercising all parts of your body. It also sometimes is due to disuse atrophy. Consult a doctor if it persists. You can also look for information in the web. I found this website very useful. http://aches.in/cramps.html
Get an ECG and a chest X-Ray done. Sore jaw is a sign of a clogged arteries and maybe impending heart attack. See your GP.
I went to see my denist and he gave me some jaw exercises to do and all you have to do is put one finger on both sides of your jaw and open and close your mouth 5 times then do the same again but witout putting your fingers on to both sides of the jawyou also do this 5 times then put one hand under your chin and open your mouth do this 5 times you need to do this evry day and knight