This is just speculation, but I think it matters more if you've hit the gym immediately prior to it coughing up EX invites. It seems like their algorithm favors raiders who have just completed the raid within the past day or two rather than a week before. Since Niantic is completely opaque with their release schedule, it's anyone's guess, but they're usually given 7-8 days apart. I'd focus on raiding more when a new wave should be coming out.
I just got one today for a raid I did earlier in the day. It's not a hard-and-fast rule (in before someone says they got theirs a week after raiding a location), but from what I've seen you have a better chance within 48 hours of the wave coming out.