coopster: sorry, I just rewrote my query here, not copied - so I'm sorry for the error :)
LifeinAsia: the product_img is varchar, because it can contain letters and other symbols.
There is no index for product_img, because its user added and simply points to a hashsum of an image, such as 0c3a3889dfdc5f6d5a1500a15b010fac
The main problem, as I understand with the query I posted above, is that since there are 1 000 000 + entries, every time it goes through 1 entry to check for duplicates, it goes through all of the 1 000 000+ rows. Right? So to check for duplicates, MySQL has to do 1 000 000 000 000 runs through the database.
So how do I make this optimized? :/