Your accepted answer is correct. Is it also possible to get the same result:
UPDATE motor inner join (SELECT max(time) as time FROM motor WHERE exec=0) mx on motor.time = mx.time SET motor.exec=1;
The only difference is that if there is more than one row with the same maximum value, LIMIT 1 will update only one of these rows, while this will update everything.
source share