Add notification bubble notice in navigation using transients

Thanks again for the help @jdm2112. Updated a few syntax errors and used the same structure you suggested, works great!

// Add notification bubble to custom post type menu nav 
add_action( 'admin_menu', 'add_cpt_menu_bubble' );
function add_cpt_menu_bubble() {
    global $menu;
    $count_posts = tms_count_pending_posts();
    if ( $count_posts > 3 ) {
        foreach ( $menu as $key => $value ) {
            if ( $menu[$key][2] == 'edit.php?post_type=custom_post_type_name' ) {
                $menu[$key][0] .= ' <span class="update-plugins count-2"><span class="update-count">' . $count_posts . '</span></span>';
                return;
            }
        }
    }
}
function tms_count_pending_posts() {
    if ( false === ( $num_posts = get_transient( 'tms_pending_posts_key' ) ) ) {
        $args = array(
            'order'    => 'DESC',
            'posts_per_page' => '-1',
            'post_type' => 'custom_post_type_name',
            'custom_tax' => 'pending-review'
        );
        $posttype_query = new WP_Query( $args );
        ($posttype_query->post_count) ? $num_posts = $posttype_query->post_count : $num_posts = 0;
        set_transient( 'tms_pending_posts_key', $num_posts, 30 ); 
    } 
    return $num_posts;
}