Toolset Support cannot provide Custom Code that is not related to Toolset API, and we can only limitedly help with WordPress, or PHP code that is not directly related to Toolset.
If you require professional assistance for Custom Code, we can suggest working together with a Consultant form this list https://toolset.com/contractors/
I see you use WordPress API to add a metabox with a function added to add_meta_boxes action.
https://developer.wordpress.org/reference/functions/add_meta_box/
https://developer.wordpress.org/reference/hooks/add_meta_boxes/
I understand you want to do (add this metabox) this only if certain conditions are met.
While I cannot help with adding the metabox, as that is WordPress API related, but can hint and link to DOC as above, I can help with the condition in this case - because it seems you want to check on related Posts, as related by the Toolset Types plugin.
We offer an API for this, toolset_get_related_post or toolset_get_related_posts.
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/
So, using that API, you can "get" related posts of a single post and - depending on what is returned - in a PHP "if()" statement, fire or abort the code that adds the metabox.
The simplest is to simply "return;" if there are no children (if toolset_get_related_posts returns empty), or/and (as you decide) the children all have an expired Custom Field set (or any data you base the condition upon)
Again here toolset_get_related_post can help, as you'll be able to "get" all that related post (or posts) data - inclusive fields or taxonomies.
You can find here many examples of how to use the API to get related posts:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
(Open the "More - Usage examples")
I suggest - when creating such custom code - to get familiar with the below function:
error_log(print_r($what_variable_you_want_to_analyse, true));
This code will allow you to always find what is inside the $what_variable_you_want_to_analyse, which you could always populate a line earlier in the code with
$what_variable_you_want_to_analyse = any_function_that_you_are_using();
Now, what will happen is that error_log function will put every data in the right structure into your debug log (which you can activate in WordPress using https://wordpress.org/support/article/debugging-in-wordpress/).
That helps a lot to see, what a certain code gives as data, whether it is empty, an array, a simple string, or else.
This is important, so when you craft the code, you can use this data properly.
Please let me know if you need further help with this, I can also provide you with some code examples on how to use the toolset API to get related posts, and I can always (try to) clarify any issue you might have or question-related to functions in WordPress orr PHP.
The only we cannot do is provide a ready to copy and paste custom code, already adapted to your site - that would be something the abovementioned Consultants would be a better referral.
Thanks!