How do i change the visibility of an existing block programmatically?
You can load the block and modify the visibility settings:

$block = \Drupal\block\Entity\Block::load('openidconnectlogin');
$visibility = $block-&gt;getVisibility();
if (isset($visibility['request_path']['pages'])) {
  $visibility['request_path']['pages'] = '/new/path';
  $block-&gt;setVisibilityConfig('request_path', $visibility['request_path']);
  $block-&gt;save();
}