There's no way to know if difference in query parameter is a different image or not, you can't simply re-use a prior URL which is equivalent but for query param in place of a new one.
contain the same images, chances are very high that other query parameters will be the same.
If they are different, chances are very high that other query parameters are also different.
Want to up your chances, then instead of only 2 requests, raise the bar to 10 different query parameter checks and add some additional db values (like CountFetch:int,sameUntillCurrentFetch:bool)
As soon as sameUntillCurrentFetch = false, then you request all images in the future.
If CountFetch = 5 and sameUntillCurrentFetch = true, then queryDiff = false.
It's kinda weird my answer was downvoted, any better solutions to avoid the stated problem then?