Change WordPress Resource URL

To dinamically change the stylesheet and template URI you can use stylesheet_uri filter and template_directory_uri filter.

For example:

add_filter( 'stylesheet_uri', function( $stylesheet_uri ) {

    $stylesheet_uri = 'your new stylesheet URI here';

    return $stylesheet_uri;

} );

But, as you are using W3TC, you can configure that change in the plugin itself (Generic Mirror and Self-hosted CDN options), even you can configure pushing files automatically if the CDN service support it.