Solve syntax errors on recent / less strict versions of MySQL