SET AUTOCOMMIT=0;
START TRANSACTION;
DELETE FROM my_table WHERE user_id=some_number;
INSERT INTO my_table (user_id, ... ) VALUES(some_number, ...);
commit;
SET AUTOCOMMIT=0;
START TRANSACTION;
DELETE FROM my_table WHERE user_id=some_number;
INSERT INTO my_table (user_id, ... ) VALUES(some_number, ...);
commit;