UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RwqmGQNPHYCI8G4NMvWo+D2u2zx3OUOdShGsDbKoSeM=' 
WHERE 
  key_id = '8edcad279a2a880fbfe25056c96645588954ab67b1dab7f947bbf461483036d0' 
  AND (
    token = 'RwqmGQNPHYCI8G4NMvWo+D2u2zx3OUOdShGsDbKoSeM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036