How can I change the plugin update server for specific plugins?

this can be done with the filter plugins_api :
https://developer.wordpress.org/reference/hooks/plugins_api/

try this code :

add_filter("plugins_api", function ($plugins_api, $action, $args) {

    if ("plugin_information" !== $action) {
        return $plugins_api;
    }


    $pluginSlug = $args->slug;


    if (... update available ...) {

        $plugins_api = new \stdClass();
        $plugins_api->name = $pluginSlug;
        $plugins_api->version = "5"; // new version
        $plugins_api->download_link = "https://server/directory/newVersion.zip";

        $plugins_api->slug = $pluginSlug;
        $plugins_api->sections = []; // sections of "view details" of update page when update is available

    }

    return $plugins_api;

}, 10, 3);

error code: 523