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