UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YI+tHQhDFIx48XRi4NG1vFR2zeN6qDN4g9SmEM2OXxU=' 
WHERE 
  key_id = 'c67a0cc35d43a131b6209bcda1b122a90254edcc8fa50df9dea29538c1d40755' 
  AND (
    token = 'YI+tHQhDFIx48XRi4NG1vFR2zeN6qDN4g9SmEM2OXxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025