SELECT 
  a.shipping_id, 
  a.company_id, 
  a.min_weight, 
  a.max_weight, 
  a.position, 
  a.status, 
  a.tax_ids, 
  a.usergroup_ids, 
  b.shipping, 
  b.delivery_time, 
  c.company AS company_name, 
  storefront_id 
FROM 
  cscart_shippings AS a 
  LEFT JOIN cscart_shipping_descriptions AS b ON a.shipping_id = b.shipping_id 
  AND b.lang_code = 'en' 
  LEFT JOIN cscart_companies AS c ON c.company_id = a.company_id 
  LEFT JOIN cscart_storefronts_shippings AS storefronts_shippings ON storefronts_shippings.shipping_id = a.shipping_id 
WHERE 
  1 = 1 
  AND (a.company_id = 462) 
  AND (
    storefronts_shippings.storefront_id IN (1) 
    OR storefronts_shippings.storefront_id IS NULL
  ) 
ORDER BY 
  a.position

Query time 0.00104

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "122.17"
    },
    "ordering_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "45.76"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "a",
            "access_type": "ALL",
            "rows_examined_per_scan": 176,
            "rows_produced_per_join": 17,
            "filtered": "10.00",
            "cost_info": {
              "read_cost": "34.68",
              "eval_cost": "3.52",
              "prefix_cost": "38.20",
              "data_read_per_join": "40K"
            },
            "used_columns": [
              "shipping_id",
              "company_id",
              "min_weight",
              "max_weight",
              "usergroup_ids",
              "tax_ids",
              "position",
              "status"
            ],
            "attached_condition": "(`webmarco`.`a`.`company_id` = 462)"
          }
        },
        {
          "table": {
            "table_name": "b",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "shipping_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "webmarco.a.shipping_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 17,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "17.60",
              "eval_cost": "3.52",
              "prefix_cost": "59.32",
              "data_read_per_join": "16K"
            },
            "used_columns": [
              "shipping_id",
              "lang_code",
              "shipping",
              "delivery_time"
            ]
          }
        },
        {
          "table": {
            "table_name": "c",
            "access_type": "const",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "company_id"
            ],
            "key_length": "4",
            "ref": [
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 17,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.00",
              "eval_cost": "3.52",
              "prefix_cost": "63.84",
              "data_read_per_join": "167K"
            },
            "used_columns": [
              "company_id",
              "company"
            ]
          }
        },
        {
          "table": {
            "table_name": "storefronts_shippings",
            "access_type": "index",
            "key": "idx_storefront_id",
            "used_key_parts": [
              "storefront_id"
            ],
            "key_length": "4",
            "rows_examined_per_scan": 13,
            "rows_produced_per_join": 45,
            "filtered": "20.00",
            "using_index": true,
            "using_join_buffer": "Block Nested Loop",
            "cost_info": {
              "read_cost": "3.42",
              "eval_cost": "9.15",
              "prefix_cost": "76.41",
              "data_read_per_join": "732"
            },
            "used_columns": [
              "storefront_id",
              "shipping_id"
            ],
            "attached_condition": "(<if>(found_match(storefronts_shippings), ((`webmarco`.`storefronts_shippings`.`storefront_id` = 1) or isnull(`webmarco`.`storefronts_shippings`.`storefront_id`)), true) and <if>(is_not_null_compl(storefronts_shippings), (`webmarco`.`storefronts_shippings`.`shipping_id` = `webmarco`.`a`.`shipping_id`), true))"
          }
        }
      ]
    }
  }
}