UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '38+1qzYjYYgZ4pN4L7RJJFpYnBzHXrNFzhg6HYUF9lE=' 
WHERE 
  key_id = 'ec3b6afd83c01563714c99eb2501c95e53388a9f8f6f7ec982abc2a794fe8ddf' 
  AND (
    token = '38+1qzYjYYgZ4pN4L7RJJFpYnBzHXrNFzhg6HYUF9lE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026