It means like "the time when"
As the person before me wrote: "図書館で本を借りる とき、カードが要ります。
= When you borrow the book at the library, you need a card (for the library). "
You can also use it in past tense with -た とき (-ta toki)
=When i was in japan, i studied Japanese.
I hope it was enough explanation :)