UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZIc74sZuPBJLrKK+vNbb2Zlf4XTZ5fZAnromcbBg15g='
WHERE
key_id = 'e7bdfb558a131e47abd63a1daa6ce7d098b0153c5367609a06952d759da24a56'
AND (
token = 'ZIc74sZuPBJLrKK+vNbb2Zlf4XTZ5fZAnromcbBg15g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)