SELECT 
  cscart_payments.*, 
  cscart_payment_descriptions.*, 
  IF (
    ISNULL(cscart_addons.status), 
    "A", 
    cscart_addons.status
  ) AS processor_status, 
  cscart_payment_processors.type AS processor_type, 
  cscart_payment_processors.processor_script AS processor_script 
FROM 
  cscart_payments 
  LEFT JOIN cscart_payment_descriptions ON cscart_payment_descriptions.payment_id = cscart_payments.payment_id 
  AND cscart_payment_descriptions.lang_code = 'en' 
  LEFT JOIN cscart_payment_processors ON cscart_payment_processors.processor_id = cscart_payments.processor_id 
  LEFT JOIN cscart_addons ON cscart_payment_processors.addon = cscart_addons.addon 
  LEFT JOIN cscart_storefronts_payments AS storefronts_payments ON storefronts_payments.payment_id = cscart_payments.payment_id 
WHERE 
  cscart_payments.status = 'A' 
  AND (
    storefronts_payments.storefront_id = 1 
    OR storefronts_payments.storefront_id IS NULL
  ) 
  AND cscart_payment_processors.processor_script IN ('stripe.php') 
HAVING 
  processor_status = 'A' 
ORDER BY 
  cscart_payments.position

Query time 0.00509

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "12.45"
    },
    "ordering_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "0.51"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_payments",
            "access_type": "ALL",
            "rows_examined_per_scan": 24,
            "rows_produced_per_join": 2,
            "filtered": "10.00",
            "cost_info": {
              "read_cost": "5.32",
              "eval_cost": "0.48",
              "prefix_cost": "5.80",
              "data_read_per_join": "6K"
            },
            "used_columns": [
              "payment_id",
              "company_id",
              "usergroup_ids",
              "position",
              "status",
              "template",
              "processor_id",
              "processor_params",
              "a_surcharge",
              "p_surcharge",
              "tax_ids",
              "localization",
              "payment_category",
              "country_selection_mode"
            ],
            "attached_condition": "(`webmarco`.`cscart_payments`.`status` = 'A')"
          }
        },
        {
          "table": {
            "table_name": "cscart_payment_processors",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "processor_id"
            ],
            "key_length": "3",
            "ref": [
              "webmarco.cscart_payments.processor_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "10.00",
            "cost_info": {
              "read_cost": "2.40",
              "eval_cost": "0.05",
              "prefix_cost": "8.68",
              "data_read_per_join": "762"
            },
            "used_columns": [
              "processor_id",
              "processor_script",
              "type",
              "addon"
            ],
            "attached_condition": "(`webmarco`.`cscart_payment_processors`.`processor_script` = 'stripe.php')"
          }
        },
        {
          "table": {
            "table_name": "cscart_addons",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "addon"
            ],
            "key_length": "98",
            "ref": [
              "webmarco.cscart_payment_processors.addon"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.24",
              "eval_cost": "0.05",
              "prefix_cost": "8.97",
              "data_read_per_join": "455"
            },
            "used_columns": [
              "addon",
              "status"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_payment_descriptions",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "payment_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "webmarco.cscart_payments.payment_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.24",
              "eval_cost": "0.05",
              "prefix_cost": "9.26",
              "data_read_per_join": "466"
            },
            "used_columns": [
              "payment_id",
              "payment",
              "description",
              "instructions",
              "surcharge_title",
              "lang_code"
            ]
          }
        },
        {
          "table": {
            "table_name": "storefronts_payments",
            "access_type": "index",
            "key": "idx_storefront_id",
            "used_key_parts": [
              "storefront_id"
            ],
            "key_length": "4",
            "rows_examined_per_scan": 10,
            "rows_produced_per_join": 0,
            "filtered": "21.25",
            "using_index": true,
            "using_join_buffer": "Block Nested Loop",
            "cost_info": {
              "read_cost": "2.58",
              "eval_cost": "0.10",
              "prefix_cost": "11.94",
              "data_read_per_join": "8"
            },
            "used_columns": [
              "storefront_id",
              "payment_id"
            ],
            "attached_condition": "(<if>(found_match(storefronts_payments), ((`webmarco`.`storefronts_payments`.`storefront_id` = 1) or isnull(`webmarco`.`storefronts_payments`.`storefront_id`)), true) and <if>(is_not_null_compl(storefronts_payments), (`webmarco`.`storefronts_payments`.`payment_id` = `webmarco`.`cscart_payments`.`payment_id`), true))"
          }
        }
      ]
    }
  }
}

Result

payment_id company_id usergroup_ids position status template processor_id processor_params a_surcharge p_surcharge tax_ids localization payment_category country_selection_mode payment description instructions surcharge_title lang_code processor_status processor_type processor_script
1 0 0 11 A addons/stripe/views/orders/components/payments/stripe.tpl 106 a:11:{s:9:"is_stripe";s:1:"Y";s:7:"is_test";s:1:"N";s:10:"webhook_id";s:27:"we_1Of0glEGJ2H61h01vVhybHnm";s:18:"webhook_secret_key";s:38:"whsec_GBAudI0YHYASZW0YP8IUaLWB1aKjLKTS";s:15:"publishable_key";s:107:"pk_test_51OXN9uEGJ2H61h01zgjaMg8GkaJhHZIomYWxJtWBIxH3LJ7WYqUm2PytSmGrxwa0BWmdpnZF1iAoWb17KWAVih8k003E7jffhw";s:10:"secret_key";s:107:"sk_test_51OXN9uEGJ2H61h016RcoKTFzwmbBK47J3VpsDN1utv0sFLyKYfGWAqL7k51lWs6jpr4au4NgHn5HEz5g5UQ0rK8U00vAxxy28x";s:19:"merchant_identifier";s:0:"";s:7:"country";s:2:"IT";s:8:"currency";s:3:"EUR";s:12:"payment_type";s:15:"stripe_checkout";s:19:"show_payment_button";s:1:"N";} 0.000 0.000 6 tab1 N Credit card Visa, Mastercard, etc... en A P stripe.php