UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K/8btdVk7N06P61QwOUoTg1jDYsXA4Mv0NoeH9P0zLY='
WHERE
key_id = 'd5daf7c9a1fa4f6a38a4df90bd348b2f853ad82d90f45d7383388708c807671d'
AND (
token = 'K/8btdVk7N06P61QwOUoTg1jDYsXA4Mv0NoeH9P0zLY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)