UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CW9p3XqZnDaN/ArRJKtpzci9L5B9DaDTlQOMk65uoqg='
WHERE
key_id = '6e22936eefc69ee6e71338606eec5f6f05ba0d16dc5842727073f34cb9f26930'
AND (
token = 'CW9p3XqZnDaN/ArRJKtpzci9L5B9DaDTlQOMk65uoqg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)