UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XIuLuh7jVMpapTi0+Dv93G89ovnAGniK6KwxE1v6MfE='
WHERE
key_id = 'ba51417898199492c6663afb8314df596a0dd16faf377a537f0dba31d95e69b7'
AND (
token = 'XIuLuh7jVMpapTi0+Dv93G89ovnAGniK6KwxE1v6MfE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)