子どものとき、野球が大好きでした。

When とき comes before a past-tense sentence. It describes when that event happened.

子どものとき、野球が大好きでした。
When I was a child, I used to love baseball.

This also works with adjectives.

若いとき、マンガが好きでした。
When I was young, I used to like manga.

Note that unlike English, the adjective doesn’t go to the past tense. とき describes a time when the speaker was still young – they hadn’t stopped being young so the adjective doesn’t take the past tense. The tense of the whole sentence is determined by the main ending でした。

This can of course work with verbs too:

東京へ行くとき、飛行機でいきました。
When I went to Tokyo, I went by plane.

Again, the fact that the journey happened in the past is shown by the final verb ending. とき describes a time when the speaker was still on their way, they hadn’t arrived, the action wasn’t completed, so the first verb doesn’t take a -た ending.

Now look at this:

東京へ行ったとき、合気道をならいました。
When I went to Tokyo, I studied Aikido.

Now とき describes a time when the speaker had arrived in Tokyo, the action was completed, so the first verb takes a -た ending.