How much time before UTI?

I peed about 40 minutes after sex, will I be okay? Or did I pee too late?