UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qn3YpkMecIc9ztGwQfqCDNG5zxMpPZaoN8ERAuBqchk='
WHERE
key_id = '7b097b2989b9ab0a33226e4fdc39aa57df94bddd00800d6c8f6fe26b24feee5e'
AND (
token = 'Qn3YpkMecIc9ztGwQfqCDNG5zxMpPZaoN8ERAuBqchk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)