Sounds like you had a mild muscle spasm. People often say they feel like they got a jolt because the muscle contracts like you got a shock. Be glad it was mild and did not put you on the floor.
I would heat, massage, foam roll, stretch (if you can without pain), and take it easy on it. Obviously avoid situations that cause you pain and try to avoid sitting or not moving for long periods of time.