select `ha_mf_monitor_status`.`updatedate` AS `updatedate`,`ha_mf_monitor_status`.`id` AS `id`,`ha_mf_monitor_status`.`deviceID` AS `deviceID`,`ha_mf_devices`.`typeID` AS `typeID`,`ha_mf_devices`.`locationID` AS `locationID`,`ha_mf_devices`.`devicelinkID` AS `devicelinkID`,now() AS `cnow`,`ha_mf_monitor_status`.`statusDate` AS `statusdate`,`ha_mf_monitor_status`.`toggleignore` AS `f1`,(`ha_mf_monitor_status`.`statusDate` + interval `ha_mf_monitor_status`.`toggleignore` minute_second) AS `diff1`, if(((`ha_mf_monitor_status`.`statusDate` + interval `ha_mf_monitor_status`.`toggleignore` minute_second) < now()),3,1) AS `stat`,`ha_mf_monitor_status`.`status` AS `status` from (`ha_mf_monitor_status` join `ha_mf_devices` on((`ha_mf_monitor_status`.`deviceID` = `ha_mf_devices`.`id`)))
Main part of concern here: if(((`ha_mf_monitor_status`.`statusDate` + interval `ha_mf_monitor_status`.`toggleignore` minute_second) < now()),3,1) AS `stat`