I need to be able to check if there is a div with class='active' and with a custom attribute data-popup='true' - eg: second one below.

How can I check if a div with these 2 characteristics exists?
I know its not correct but I have been playing with the following code:
if($('div#mainContainer div.active div[data-unique='+urlUnique+']').length > 0) {
In the long run there will be many DIV's so it needs to find if one with this class and data attribute exists.
thx