UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XP/Xvi3uadgdW4iR1crYmB6V0kdRXyPJHWhst/HMgHk='
WHERE
key_id = '6ba834f96e21d997d10ae1c39fa4f883322098abe473d39c8f06db0526c009ae'
AND (
token = 'XP/Xvi3uadgdW4iR1crYmB6V0kdRXyPJHWhst/HMgHk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)