Replace one coupon to another after coupon added

This requires to use an action hook like woocommerce_calculate_totals that is related to cart and Ajax enabled, because it will handle all changes made by the customer in cart page:

add_action( 'woocommerce_calculate_totals', 'discount_based_on_cart_subtotal', 10, 1 );
function discount_based_on_cart_subtotal( $cart ) {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;

    // Avoiding hook repetitions
    if ( did_action( 'woocommerce_calculate_totals' ) >= 2 )
        return;

    // Your coupons settings below
    $coupon_05_off="$5-Off";
    $coupon_10_off="$10-Off";

    // When cart subtotal is below 50
    if ( $cart->subtotal < 50 ) {
        if ( $cart->has_discount( $coupon_10_off ) ) {
            $cart->remove_coupon( $coupon_10_off ); // Remove $10.00 fixed discount coupon
            if ( ! $cart->has_discount( $coupon_05_off ) ) {
                 $cart->apply_coupon( $coupon_05_off ); // Add $5.00 fixed discount coupon
            }
        }

    }
    // When cart subtotal is up to 50
    else {
        if ( $cart->has_discount( $coupon_05_off ) ) {
            $cart->remove_coupon( $coupon_05_off ); // Remove $5.00 fixed discount coupon
            if ( ! $cart->has_discount( $coupon_10_off ) ) {
                $cart->apply_coupon( $coupon_10_off ); // Add $10.00 fixed discount coupon
            }
        }
    }
}

Code goes in functions.php file of your active child theme (or active theme). Tested and work.