SELECT 
  cscart_banners.banner_id, 
  cscart_banners.type, 
  cscart_banners.target, 
  cscart_banners.status, 
  cscart_banners.timestamp, 
  cscart_banner_descriptions.banner, 
  cscart_banner_descriptions.description, 
  cscart_banner_descriptions.url, 
  cscart_banner_images.banner_image_id, 
  cscart_banner_descriptions.et_text, 
  cscart_banner_descriptions.et_settings 
FROM 
  cscart_banners 
  LEFT JOIN cscart_banner_descriptions ON cscart_banner_descriptions.banner_id = cscart_banners.banner_id 
  AND cscart_banner_descriptions.lang_code = 'en' 
  LEFT JOIN cscart_banner_images ON cscart_banner_images.banner_id = cscart_banners.banner_id 
  AND cscart_banner_images.lang_code = 'en' 
WHERE 
  1 
  AND (
    cscart_banners.type != 'G' 
    OR cscart_banner_images.banner_image_id IS NOT NULL
  ) 
  AND cscart_banners.banner_id IN (2476) 
  AND cscart_banners.status = 'A' 
  AND IF (
    cscart_banners.type not like 'abt__ut2', 
    'available', 
    IF (
      cscart_banners.type like 'abt__ut2' 
      AND (
        cscart_banners.abt__ut2_use_avail_period = 'N' 
        OR (
          cscart_banners.abt__ut2_use_avail_period = 'Y' 
          AND (
            cscart_banners.abt__ut2_avail_from = 0 
            OR cscart_banners.abt__ut2_avail_from <= 1732186709
          ) 
          AND (
            cscart_banners.abt__ut2_avail_till = 0 
            OR cscart_banners.abt__ut2_avail_till >= 1732186709
          )
        )
      ), 
      'available', 
      'not available'
    )
  ) = 'available' 
ORDER BY 
  cscart_banner_descriptions.banner asc

Query time 0.00152

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "1.00"
    },
    "ordering_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_banners",
            "access_type": "const",
            "possible_keys": [
              "PRIMARY",
              "status"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "banner_id"
            ],
            "key_length": "3",
            "ref": [
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.20",
              "prefix_cost": "0.00",
              "data_read_per_join": "2K"
            },
            "used_columns": [
              "banner_id",
              "status",
              "type",
              "target",
              "timestamp",
              "abt__ut2_use_avail_period",
              "abt__ut2_avail_from",
              "abt__ut2_avail_till"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_banner_descriptions",
            "access_type": "const",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "banner_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "const",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.20",
              "prefix_cost": "0.00",
              "data_read_per_join": "5K"
            },
            "used_columns": [
              "banner_id",
              "banner",
              "url",
              "description",
              "lang_code",
              "et_text",
              "et_settings"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_banner_images",
            "access_type": "const",
            "possible_keys": [
              "banner"
            ],
            "key": "banner",
            "used_key_parts": [
              "banner_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "const",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.20",
              "prefix_cost": "0.00",
              "data_read_per_join": "16"
            },
            "used_columns": [
              "banner_image_id",
              "banner_id",
              "lang_code"
            ]
          }
        }
      ]
    }
  }
}

Result

banner_id type target status timestamp banner description url banner_image_id et_text et_settings
2476 E T A 1636671600 gridemme 352263 a:3:{s:7:"desktop";a:5:{s:9:"image_url";s:0:"";s:5:"title";s:18:"With Emme Shopping";s:4:"text";s:68:"You will look great on any occasion or any ceremony you attend. ";s:8:"btn_text";s:8:"About Us";s:7:"btn_url";s:56:"/index.php?dispatch=companies.description&company_id=174";}s:5:"phone";a:5:{s:9:"image_url";s:0:"";s:5:"title";s:21:"With Emme Shopping ";s:4:"text";s:68:"You will look great on any occasion or any ceremony you attend. ";s:8:"btn_text";s:8:"About Us";s:7:"btn_url";s:56:"/index.php?dispatch=companies.description&company_id=174";}s:6:"tablet";a:5:{s:9:"image_url";s:0:"";s:5:"title";s:21:"With Emme Shopping ";s:4:"text";s:68:"You will look great on any occasion or any ceremony you attend. ";s:8:"btn_text";s:8:"About Us";s:7:"btn_url";s:56:"/index.php?dispatch=companies.description&company_id=174";}} a:3:{s:7:"desktop";a:70:{s:3:"bkg";s:7:"#ffffff";s:9:"image_pos";s:1:"H";s:10:"image_pos2";s:1:"L";s:10:"image_pos3";s:1:"A";s:10:"image_pos4";s:1:"T";s:10:"image_vert";s:1:"T";s:11:"image_horiz";s:1:"L";s:12:"image_margin";s:15:"0px 0px 0px 0px";s:10:"image_anim";s:1:"A";s:12:"title_shadow";s:1:"N";s:8:"title_lh";s:6:"normal";s:10:"title_size";s:2:"30";s:12:"title_weight";s:1:"B";s:11:"title_style";s:1:"N";s:11:"title_color";s:7:"#000000";s:17:"title_bkg_enabled";s:1:"N";s:15:"title_bkg_color";s:7:"#000000";s:17:"title_bkg_opacity";s:3:"100";s:19:"title_inner_padding";s:15:"0px 0px 0px 0px";s:15:"title_bkg_round";s:1:"0";s:13:"title_padding";s:15:"0px 0px 0px 0px";s:11:"title_align";s:1:"C";s:10:"title_anim";s:1:"A";s:11:"text_shadow";s:1:"N";s:7:"text_lh";s:6:"normal";s:9:"text_size";s:2:"22";s:11:"text_weight";s:1:"N";s:10:"text_style";s:1:"N";s:10:"text_color";s:7:"#000000";s:17:"descr_bkg_enabled";s:1:"N";s:15:"descr_bkg_color";s:7:"#000000";s:17:"descr_bkg_opacity";s:3:"100";s:18:"text_inner_padding";s:15:"0px 0px 0px 0px";s:15:"descr_bkg_round";s:1:"0";s:12:"text_padding";s:16:"10px 0px 0px 0px";s:11:"descr_align";s:1:"C";s:10:"descr_anim";s:1:"A";s:10:"btn_shadow";s:1:"N";s:8:"btn_size";s:2:"16";s:10:"btn_weight";s:1:"B";s:9:"btn_style";s:1:"N";s:9:"btn_round";s:4:"20px";s:14:"btn_text_color";s:7:"#000000";s:15:"btn_bkg_enabled";s:1:"N";s:13:"btn_bkg_color";s:7:"#000000";s:15:"btn_bkg_opacity";s:3:"100";s:20:"btn_text_color_hover";s:7:"#ffffff";s:21:"btn_hover_bkg_enabled";s:1:"Y";s:19:"btn_bkg_color_hover";s:7:"#9f58eb";s:21:"btn_bkg_opacity_hover";s:3:"100";s:17:"btn_border_enable";s:1:"Y";s:15:"btn_border_size";s:1:"2";s:16:"btn_border_style";s:1:"S";s:16:"btn_border_color";s:7:"#000000";s:18:"btn_border_opacity";s:3:"100";s:22:"btn_hover_border_color";s:7:"#9f58eb";s:24:"btn_hover_border_opacity";s:3:"100";s:11:"btn_padding";s:9:"10px 15px";s:9:"btn_horiz";s:1:"C";s:10:"btn_margin";s:16:"20px 0px 0px 0px";s:8:"btn_anim";s:1:"A";s:13:"wrapper_width";s:4:"auto";s:4:"vert";s:1:"C";s:5:"horiz";s:1:"C";s:14:"wrapper_margin";s:15:"0px 0px 0px 0px";s:19:"wrapper_bkg_enabled";s:1:"N";s:17:"wrapper_bkg_color";s:7:"#000000";s:19:"wrapper_bkg_opacity";s:3:"100";s:15:"wrapper_padding";s:15:"0px 0px 0px 0px";s:13:"wrapper_round";s:1:"0";}s:5:"phone";a:73:{s:7:"enabled";s:1:"Y";s:3:"bkg";s:7:"#ffffff";s:6:"target";s:1:"T";s:3:"url";s:0:"";s:9:"image_pos";s:1:"H";s:10:"image_pos2";s:1:"L";s:10:"image_pos3";s:1:"A";s:10:"image_pos4";s:1:"T";s:10:"image_vert";s:1:"T";s:11:"image_horiz";s:1:"L";s:12:"image_margin";s:15:"0px 0px 0px 0px";s:10:"image_anim";s:1:"A";s:12:"title_shadow";s:1:"N";s:8:"title_lh";s:6:"normal";s:10:"title_size";s:2:"22";s:12:"title_weight";s:1:"B";s:11:"title_style";s:1:"N";s:11:"title_color";s:7:"#000000";s:17:"title_bkg_enabled";s:1:"N";s:15:"title_bkg_color";s:7:"#000000";s:17:"title_bkg_opacity";s:3:"100";s:19:"title_inner_padding";s:15:"0px 0px 0px 0px";s:15:"title_bkg_round";s:1:"0";s:13:"title_padding";s:15:"0px 0px 0px 0px";s:11:"title_align";s:1:"C";s:10:"title_anim";s:1:"A";s:11:"text_shadow";s:1:"N";s:7:"text_lh";s:6:"normal";s:9:"text_size";s:2:"18";s:11:"text_weight";s:1:"N";s:10:"text_style";s:1:"N";s:10:"text_color";s:7:"#000000";s:17:"descr_bkg_enabled";s:1:"N";s:15:"descr_bkg_color";s:7:"#000000";s:17:"descr_bkg_opacity";s:3:"100";s:18:"text_inner_padding";s:15:"0px 0px 0px 0px";s:15:"descr_bkg_round";s:1:"0";s:12:"text_padding";s:16:"10px 0px 0px 0px";s:11:"descr_align";s:1:"C";s:10:"descr_anim";s:1:"A";s:10:"btn_shadow";s:1:"N";s:8:"btn_size";s:2:"14";s:10:"btn_weight";s:1:"B";s:9:"btn_style";s:1:"N";s:9:"btn_round";s:4:"20px";s:14:"btn_text_color";s:7:"#000000";s:15:"btn_bkg_enabled";s:1:"N";s:13:"btn_bkg_color";s:7:"#000000";s:15:"btn_bkg_opacity";s:3:"100";s:20:"btn_text_color_hover";s:7:"#ffffff";s:21:"btn_hover_bkg_enabled";s:1:"Y";s:19:"btn_bkg_color_hover";s:7:"#9f58eb";s:21:"btn_bkg_opacity_hover";s:3:"100";s:17:"btn_border_enable";s:1:"Y";s:15:"btn_border_size";s:1:"2";s:16:"btn_border_style";s:1:"S";s:16:"btn_border_color";s:7:"#000000";s:18:"btn_border_opacity";s:3:"100";s:22:"btn_hover_border_color";s:7:"#9f58eb";s:24:"btn_hover_border_opacity";s:3:"100";s:11:"btn_padding";s:9:"10px 15px";s:9:"btn_horiz";s:1:"C";s:10:"btn_margin";s:16:"20px 0px 0px 0px";s:8:"btn_anim";s:1:"A";s:13:"wrapper_width";s:4:"auto";s:4:"vert";s:1:"C";s:5:"horiz";s:1:"C";s:14:"wrapper_margin";s:15:"5px 0px 0px 0px";s:19:"wrapper_bkg_enabled";s:1:"N";s:17:"wrapper_bkg_color";s:7:"#000000";s:19:"wrapper_bkg_opacity";s:3:"100";s:15:"wrapper_padding";s:15:"0px 0px 0px 0px";s:13:"wrapper_round";s:1:"0";}s:6:"tablet";a:73:{s:7:"enabled";s:1:"N";s:3:"bkg";s:7:"#ffffff";s:6:"target";s:1:"T";s:3:"url";s:0:"";s:9:"image_pos";s:1:"H";s:10:"image_pos2";s:1:"L";s:10:"image_pos3";s:1:"A";s:10:"image_pos4";s:1:"T";s:10:"image_vert";s:1:"T";s:11:"image_horiz";s:1:"L";s:12:"image_margin";s:15:"0px 0px 0px 0px";s:10:"image_anim";s:1:"A";s:12:"title_shadow";s:1:"N";s:8:"title_lh";s:6:"normal";s:10:"title_size";s:2:"22";s:12:"title_weight";s:1:"B";s:11:"title_style";s:1:"N";s:11:"title_color";s:7:"#000000";s:17:"title_bkg_enabled";s:1:"N";s:15:"title_bkg_color";s:7:"#000000";s:17:"title_bkg_opacity";s:3:"100";s:19:"title_inner_padding";s:15:"0px 0px 0px 0px";s:15:"title_bkg_round";s:1:"0";s:13:"title_padding";s:15:"0px 0px 0px 0px";s:11:"title_align";s:1:"C";s:10:"title_anim";s:1:"A";s:11:"text_shadow";s:1:"N";s:7:"text_lh";s:6:"normal";s:9:"text_size";s:2:"18";s:11:"text_weight";s:1:"N";s:10:"text_style";s:1:"N";s:10:"text_color";s:7:"#000000";s:17:"descr_bkg_enabled";s:1:"N";s:15:"descr_bkg_color";s:7:"#000000";s:17:"descr_bkg_opacity";s:3:"100";s:18:"text_inner_padding";s:15:"0px 0px 0px 0px";s:15:"descr_bkg_round";s:1:"0";s:12:"text_padding";s:16:"10px 0px 0px 0px";s:11:"descr_align";s:1:"C";s:10:"descr_anim";s:1:"A";s:10:"btn_shadow";s:1:"N";s:8:"btn_size";s:2:"14";s:10:"btn_weight";s:1:"B";s:9:"btn_style";s:1:"N";s:9:"btn_round";s:4:"20px";s:14:"btn_text_color";s:7:"#000000";s:15:"btn_bkg_enabled";s:1:"N";s:13:"btn_bkg_color";s:7:"#000000";s:15:"btn_bkg_opacity";s:3:"100";s:20:"btn_text_color_hover";s:7:"#ffffff";s:21:"btn_hover_bkg_enabled";s:1:"Y";s:19:"btn_bkg_color_hover";s:7:"#9f58eb";s:21:"btn_bkg_opacity_hover";s:3:"100";s:17:"btn_border_enable";s:1:"Y";s:15:"btn_border_size";s:1:"2";s:16:"btn_border_style";s:1:"S";s:16:"btn_border_color";s:7:"#000000";s:18:"btn_border_opacity";s:3:"100";s:22:"btn_hover_border_color";s:7:"#9f58eb";s:24:"btn_hover_border_opacity";s:3:"100";s:11:"btn_padding";s:9:"10px 15px";s:9:"btn_horiz";s:1:"C";s:10:"btn_margin";s:16:"20px 0px 0px 0px";s:8:"btn_anim";s:1:"A";s:13:"wrapper_width";s:4:"auto";s:4:"vert";s:1:"C";s:5:"horiz";s:1:"C";s:14:"wrapper_margin";s:15:"5px 0px 0px 0px";s:19:"wrapper_bkg_enabled";s:1:"N";s:17:"wrapper_bkg_color";s:7:"#000000";s:19:"wrapper_bkg_opacity";s:3:"100";s:15:"wrapper_padding";s:15:"0px 0px 0px 0px";s:13:"wrapper_round";s:1:"0";}}