Keywords are used the very moment you wake up, because sometimes you forget minutes after you wake up. If you can be sure you didn't forget anything, then go ahead and start writing- but it has happened to me that while I'm writing I realize I'm forgetting, so if I write three keywords that point to something essential in the dream (such as a name, place, or something like that) it's easier to remember the whole dream and not just the beginning. In other words, you can do it all at once: Wake up, write "house boy and train", and then start writing..... "I woke up in the house and found a boy standing by the bed who said "the train, don't forget the train".....etc.
And of course, if you wake up at 2am from a dream and write down the keywords, later on when you wake in the morning you have a better chance of recording that one also, not the one you just had before the natural wakeup time.