Bulk update or create

I have a huge data set that’s coming in, and I need to either update a record or create a new one using a db index.

In MySQL it would be as simple as

INSERT INTO table VALUES val1, val2, val3 ON DUPLICATE KEY UPDATE val1 = something;

However, I can’t seem to find a way to do this in CakePHP. Is there some way or do I need to use a raw query for this?

Having come up against the same problem, it depends on your needs. If you need the ORM features like validation, use the ORM.
If you want pure speed, write a raw bulk insert or load a file directly into a table.

Worth a mention is that in my specific case, turning off validation and atomic inserts I got a speed boost good enough for my needs. I would pass in 500 lines of data, and save each entity in a for loop, and wrapped the entire loop in a transaction (using the begin and commit methods on the Datasource itself)