Transients API conditional

You could use a sanitized version of the URL as part of the name of the transient … but transient names are limited in their size.

I would store the transient as an array with the URL and the HTML as two parts. Then check if the URL is the same. If it is, use the HTML, else update the transient. Do not save two depended values in different places; this leads to unnecessary synchronization problems.