How do I programmatically update or delete menu items?
First you will have to load the entity. Either way works:

$menu_link = MenuLinkContent::load($menu_link_id);

or ...

$menu_link = \Drupal::entityTypeManager()-&gt;getStorage('menu_link_content')-&gt;load($menu_link_id);


Next you can update value using set() method or through the magic method __set...

$menu_link-&gt;expanded = TRUE;

To save, simply call the save() method.
To delete, simply call the delete() method.