code: func (ssa *SQLStorageAuthority) CountInvalidAuthorizations2(ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest) (*sapb.Count, error) {
  	var count int64
  	err := ssa.dbMap.WithContext(ctx).SelectOne(
  		&count,
  		`SELECT COUNT(1) FROM authz2 WHERE
  		registrationID = :regID AND
  		identifierValue = :ident AND
  		expires > :expiresEarliest AND
  		expires <= :expiresLatest AND
  		status = :status`,
  		map[string]interface{}{
  			"regID":           *req.RegistrationID,
  			"ident":           *req.Hostname,
  			"expiresEarliest": time.Unix(0, *req.Range.Earliest),
  			"expiresLatest":   time.Unix(0, *req.Range.Latest),
  			"status":          statusUint(core.StatusInvalid),
  		},
  	)
  	if err != nil {
  		return nil, err
  	}
  	// Also count old authorizations and add those to the new style
  	// count
  	oldCount, err := ssa.CountInvalidAuthorizations(ctx, req)
  	if err != nil {
  		return nil, err
  	}
  	count += *oldCount.Count
  	return &sapb.Count{Count: &count}, nil
  }
docs: // CountInvalidAuthorizations2 counts invalid authorizations for a user expiring
  // in a given time range. This method is intended to deprecate CountInvalidAuthorizations.