UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xYhf4vZ0ixz9evjSccYpVZLGIARcNdAgjK9W4raeTUo='
WHERE
key_id = '18246e8f1c57eefe15e65cbbc675c1ecb3c34aa5da2ece4c821b5c3bf72afc89'
AND (
token = 'xYhf4vZ0ixz9evjSccYpVZLGIARcNdAgjK9W4raeTUo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)