Record inheritance in mySQL
If you want to store it as a hierarchical structure, the pattern that would best serve you is the "Closure Table" pattern, which allows for subtree operations (select/update/delete all descendants of x).

A generic example (closure table c and data table d) of what flagging an entry and all children at all levels below it would look like this:

UPDATE d 
INNER JOIN c ON c.descendant_id = d.id
SET d.flag=1 
WHERE c.ancestor_id = @thetopmostdesiredentry;


Here are some well written resources on how to implement that:

https://www.percona.com/blog/2011/02/14/moving-subtrees-in-closure-table/
https://coderwall.com/p/lixing/closure-tables-for-browsing-trees-in-sql
http://karwin.blogspot.com/2010/03/rendering-trees-with-closure-tables.html

The best place to read about it is Bill Karwin's book "SQL Anti-patterns", which details it as an alternative to less savory patterns.