UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XL+gWZtcFEwMvsKPdHMaGKZK9bCZMcZ8Giw9vNvqYDA='
WHERE
key_id = '49918b0ea1c018206975b15d25fc4e8a0e004c7bbbb65f1c3a74443e2087533b'
AND (
token = 'XL+gWZtcFEwMvsKPdHMaGKZK9bCZMcZ8Giw9vNvqYDA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)