UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qsWpwOs3VgRKHCSL5OUGRQ0ZNCmgEfuwMH+C3cQ/IU8='
WHERE
key_id = 'c9fdadf9655acd69ab9a435cf46076543567198b01201b2b1a8e2363d2bd5f93'
AND (
token = 'qsWpwOs3VgRKHCSL5OUGRQ0ZNCmgEfuwMH+C3cQ/IU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)