You can not put condition in callback function as it will display the meta box without the HTML.
Better you can wrap add_meta_box()
in if
condition.
If you are on post edit screen you can get the post id in this way.
$post_id = false;
if (!empty($_POST['post_ID'])) {
$post_id = $_POST['post_ID'];
} else if (!empty($_GET['post'])) {
$post_id = $_GET['post'];
}
if (get_post_meta($post_id, 'yourKey', true)) {
add_meta_box($id, $title, $callback, $screen, $context, $priority, $callback_args);
}