UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qyjmvK/Q5SI5p0sV8mO2N0XbcLnSKBjgX71/UP6LlWc=' 
WHERE 
  key_id = '540c90e3ea77f9f3f26d780693c97a558176bdc417c143fc4561a3d6299cebc5' 
  AND (
    token = 'qyjmvK/Q5SI5p0sV8mO2N0XbcLnSKBjgX71/UP6LlWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055