UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sf18ZSAXsWeW7lM9T8aeEOqERVKodHF2W/qbHGgtc/o='
WHERE
key_id = '3bbd74f70976ba34a3077d74cdc553b48668cc6edf4c4362baef6fdf5e67bc37'
AND (
token = 'Sf18ZSAXsWeW7lM9T8aeEOqERVKodHF2W/qbHGgtc/o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)