UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N8TrFtPZvOO6G8GasHWDg6l9va74ZgRRNtVghHcVTws='
WHERE
key_id = '1a9b05b63e57c9f05c63bed62d4dd8bf1a9d55b315ea540f234cd96e362c9443'
AND (
token = 'N8TrFtPZvOO6G8GasHWDg6l9va74ZgRRNtVghHcVTws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)