Yeah Mr Hunt .. considering that for long term solution, Thank You. Just looking for temp and fast solution for the issue as the lect will redo the quiz again in 3 days time. Downtime only can be done on weekend.

The student number is just 118 person ( this never happen previously in moodle 1.9 and mysql 5 )

Well, upgrading 2.3.1 -> 2.3.x should be a minor change that is safe to do at almost any time, and you should plan to do that regularly, after each minor release, to get the latest security and bug fixes.

Upgrading 2.3.x to 2.4.y or 2.5.y is a bigger change. You need to read the release notes, perhaps give some advanced warning to your staff.

So, I would say, a minor upgrade is something you could do at the weekend. For a major upgrade you might consider planning to do those during the schoold vacation.

Since I don't know why you are getting these deadlocks, I cannot guess if it is likely to happen again when the teacher re-runs the quiz. Did it happen a lot, or was it just one or two students?