Improve query to avoid c_quiz table lock - refs BT#7268