I already got this working, however I'm asking if I could do it better (preferably somehow reduce the amount of all the conditions in WHERE) or if there is a way that takes less execution time (although this seems to work much faster than PHP looping every single update query).
I have to update multiple rows (will probably be between 100-10000 once in production) in a table with 7 primary keys (yeah..i'm almost at a point where I want to just stick a one primary id key on it, but I'd have to go back and recode so much of my browser game then...) I can't use INSERT .. ON KEY DUPLICATE because I shouldn't insert the update if it doesn't exist anymore (doing some REMOVEs on the same table just before updates)
My current solution:
UPDATE planet_market SET
amount = CASE
WHEN resource_id=1 AND type=0 AND price=2000 AND player_id=-1 AND planet_id=1 AND owner_type=2 AND factory_id=70 THEN 1
WHEN resource_id=1 AND type=0 AND price=2700 AND player_id=-1 AND planet_id=1 AND owner_type=2 AND factory_id=161 THEN 181
ELSE amount END
WHERE (resource_id=1 AND type=0 AND price=2000 AND player_id=-1 AND planet_id=1 AND owner_type=2 AND factory_id=70) OR (resource_id=1 AND type=0 AND price=2700 AND player_id=-1 AND planet_id=1 AND owner_type=2 AND factory_id=161)
So is there a better (shorter query) or faster (execution) way to do this?