UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iQN+VtQNltTYDF9KjuQo7ASeR/tRag3EdbKnyixok5c=' 
WHERE 
  key_id = 'c0495f62498a1e78ef7193502ed135d10d690cbbd499bc012a888c00f744680f' 
  AND (
    token = 'iQN+VtQNltTYDF9KjuQo7ASeR/tRag3EdbKnyixok5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016