code: func (s *server) UpdateSession(req UpdateRequest) error {
  	if err := req.Check(); err != nil {
  		return trace.Wrap(err)
  	}
  
  	key := activeKey(req.Namespace, string(req.ID))
  
  	// Try several times, then give up
  	for i := 0; i < sessionUpdateAttempts; i++ {
  		item, err := s.bk.Get(context.TODO(), key)
  		if err != nil {
  			return trace.Wrap(err)
  		}
  
  		var session Session
  		if err := json.Unmarshal(item.Value, &session); err != nil {
  			return trace.Wrap(err)
  		}
  
  		if req.TerminalParams != nil {
  			session.TerminalParams = *req.TerminalParams
  		}
  		if req.Active != nil {
  			session.Active = *req.Active
  		}
  		if req.Parties != nil {
  			session.Parties = *req.Parties
  		}
  		newValue, err := json.Marshal(session)
  		if err != nil {
  			return trace.Wrap(err)
  		}
  		newItem := backend.Item{
  			Key:     key,
  			Value:   newValue,
  			Expires: s.clock.Now().UTC().Add(s.activeSessionTTL),
  		}
  
  		_, err = s.bk.CompareAndSwap(context.TODO(), *item, newItem)
  		if err != nil {
  			if trace.IsCompareFailed(err) || trace.IsConnectionProblem(err) {
  				s.clock.Sleep(sessionUpdateRetryPeriod)
  				continue
  			}
  			return trace.Wrap(err)
  		} else {
  			return nil
  		}
  	}
  	return trace.ConnectionProblem(nil, "failed concurrently update the session")
  }
docs: // UpdateSession updates session parameters - can mark it as inactive and update it's terminal parameters