UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HZjcEs/DaKkIqPUUAc+rPrY9jGWT4f01eemoVy2RC2c='
WHERE
key_id = 'ffa7960c9e119316e907a5c0399dac7c30efb8200614de896d5811090274e119'
AND (
token = 'HZjcEs/DaKkIqPUUAc+rPrY9jGWT4f01eemoVy2RC2c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)