Försök så här:
UPDATE Table1 t1
JOIN (
SELECT `PrimaryId`,
`SecondaryId`,
(SELECT count(*)
FROM Table1 t1
WHERE t1.`SecondaryId` = t.`SecondaryId`
AND t1.`PrimaryId` <= t.`PrimaryId`
) `Order`
FROM Table1 t
) t2
ON t1.`PrimaryId` = t2.`PrimaryId`
SET t1.`Order` = t2.`Order`
;
Demo --> http://www.sqlfiddle.com/#!2/6f2102 /1