update all rows after insertion in mysql
Updating all rows in a table is seriously non-scalable.

Consider tossing active and updated_at.  Change created_at to be DEFAULT CURRENT_TIMESTAMP (or something like that).  And have INDEX(created_at).  Then,

SELECT ...
    ORDER BY created_at DESC  LIMIT 1


Will get the "latest" row (which seems to be your "active").

If there is a risk of inserting two rows in the same second, there are workarounds.