Roughly 30 minutes before I hit the pillow works for me. I use the normal melatonin (non-chews), but I suck on them till they dissolve in my mouth, because I hate when they get stuck in my epiglottis; you get used to the bitter flavor after a bit. I'm going to assume this is safe because chewables exist.
Water isn't a magic lubricant. Pills still get stuck in my epiglottis with water. Usually when I take pills, I do it followed by a piece of bread and then water, but prior to bed I don't want to eat anything after brushing my teeth and the pill dissolves nicely, and like I said, I assume it's safe, because chewables exist (obviously other drugs don't work in a similar manner).