UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rHIXyYjvcA9jOYAlfoU53UpsDLElKvTgCkZKtyR9C8I='
WHERE
key_id = '8a23d78753f39cf6aabb9e066fc0c79629beb4fc7afeb9dbc27057fa0a151bb3'
AND (
token = 'rHIXyYjvcA9jOYAlfoU53UpsDLElKvTgCkZKtyR9C8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)