Trim the part of composition in After Effects along with its key frames
As Alex suggested, precomping is the answer to your question. There is no other way to have two separate compositions within one composition. Precomping is a normal part of the After Effects workflow, and is in fact necessary for many effects to work properly with nested elements.

It need not be messy – just organize your project well and label everything clearly. Learning to navigate between your comps with the Tab key will help you to use this workflow efficiently.