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