Remove "Edit Page" from admin bar if page is locked

I'm looking to remove the "Edit Page" link on the Admin bar if pages have been locked for editing i.e. nbt_block_post = 1
This is my code:

add_action('wp_before_admin_bar_render', 'remove_admin_bar_menus', 999);
function remove_admin_bar_menus() {
global $wp_admin_bar;
echo get_post_meta( get_the_ID(), 'nbt_block_post', true );
If (! is_super_admin())
/* **edit-profile is the ID** */

If (get_post_meta( get_the_ID(), 'nbt_block_post', true ) == '1');


The links are removed under the criteria I have specified, but if you navigate to a non-locked page the "Edit Page" link doesn't reappear.

How do I show the edit page link for non locked pages?

Wordpress 4.7 - configured as multisite