UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9QrA50dSRgdjHryTYS7MjcNWfmo8CC5ZiM18Mt24Ad8='
WHERE
key_id = 'da756681f80e9a063a97635c70bd871a091dd1cb763236b4b50354441e21db65'
AND (
token = '9QrA50dSRgdjHryTYS7MjcNWfmo8CC5ZiM18Mt24Ad8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)