Lock is a reserved keyword in MySQL 5.5+

Determine if the database being used is MySQL, if so, use backticks to quote the column name `lock`. For anything other than MySQL, use double-quotes "lock".