UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MSo2NpGPVYRhH4a6vobVnD4UGIGrUzTSKbr1eQVKk94='
WHERE
key_id = 'a2ee67e5c08eaa05eb99f93d99e4d17c59cfd209598bad21e7e43570cf50d247'
AND (
token = 'MSo2NpGPVYRhH4a6vobVnD4UGIGrUzTSKbr1eQVKk94='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)