We've seen a similar problem with even a smaller class than this. We've never been able to figure out how to reproduce the problem so that we can test solutions. However, since we moved our database to a percona cluster running on several separated systems we haven't seen this particular problem occur again. Our database cluster is a cluster of 5 with some SSDs and some spinning disks and it runs pretty fast and has some redundancy for failure. We have had several failures with some bad SSDs but those failures did not interrupt service.
We recently had a similar problem that had nothing to do with quizzes. We saw that we were hitting the limit of php threads. The problem ended up not being about php threads, though. It was about other scripts running out-dated optimize table commands on one of the tables in the database.
One thing we do is advise our instructors not to use moodle for high stakes testing. We still aren't convinced it will be able to handle it and would prefer not to have a failure occur for a high stakes test.