UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XtwMb97BZMiJnkrP+hSitZtWW5nx51rNLvEU2ZofWL8=' 
WHERE 
  key_id = 'c7d7b905c49d5486fb01476572275b2f302f134c1594f4de3c7e39d560ab45f7' 
  AND (
    token = 'XtwMb97BZMiJnkrP+hSitZtWW5nx51rNLvEU2ZofWL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032