UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aYjhvf3bhcueBvx7YVqbsBDjd1b3T/zE6kUkvLhELTo='
WHERE
key_id = 'a81bc9aeb8f1bae3dc39e94367f07b8ec86aa762e55e44573c052b2afac7454e'
AND (
token = 'aYjhvf3bhcueBvx7YVqbsBDjd1b3T/zE6kUkvLhELTo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)