UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TG08f5cxbXzlkBp9voRwewwsaQ1f+sGuRqsLultuYZo=' 
WHERE 
  key_id = 'cb7a6c0bc440611df029a186ed4ce027d7f491cf39dfcbebef392370b855dcaa' 
  AND (
    token = 'TG08f5cxbXzlkBp9voRwewwsaQ1f+sGuRqsLultuYZo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034