Fixed MySQL insert-or-replace SQL statement syntax. Should fix #1124.