Redirect specific link for logged in users only to specific URL

you can check the query string and redirect if query string matches the product id.

function my_logged_in_redirect() {
    if ( is_user_logged_in() && is_page( 90 ) && $_GET['add-to-cart'] == 15169 ) {
        wp_redirect( get_permalink( 15498 ) );
        die;
    }
}
add_action( 'template_redirect', 'my_logged_in_redirect' );

tech