Mysql 1.5 times the amount of data leads to more than 20 times execution time?

the following code implements tagging the data. After a carPlate appears (set to 2 for the first time), the mark is invalid within 1 hour (set to 1), the first one for more than 1 hour is set to 2, and so on.

the main problem is that I have several tables with the same data structure and index. The result is a table with 90 million rows, and this code executes for more than 300 seconds.
in a table with 150 million rows, it takes more than 7000 seconds to execute. It really doesn"t understand. It has increased the
join_buffer_size
key_buffer_size
myisam_sort_buffer_size
sort_buffer_size
and other buffer to the original 4 times (before and after changing the buffer is the above results, 90 million rows on more than 300 seconds, 150 million rows on 6000-7000 seconds), it doesn"t work.

SET @lastCarPlate="",@lastCheckTime="",@state=0;

update foreignAna_source_data_cameraPoint_201801NA t
set 
        t.tripState=@state:=case when @lastCarPlate<>t.carPlate or TIMESTAMPDIFF(MINUTE,@lastCheckTime,t.throughTime)>=60 then 2 else 1 end,
        t.tripState=  case when "x"=(@lastCarPlate:=t.carPlate) or "x"=( @lastCheckTime:=case when @state=1 then @lastCheckTime else t.throughTime end) then @state else @state end
where t.dataValid>0 and t.cameraPoint_id in (SELECT addressID from baseService_camerapoint_base_info where crange=2)
ORDER BY
    t.dayOfMonth,t.carPlate,t.throughTime;

the table structure is as follows:

CREATE TABLE `NewTable` (
`id`  int(11) NOT NULL AUTO_INCREMENT ,
`carPlate`  varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`plateColorTail`  tinyint(4) NOT NULL ,
`cameraPoint_id`  mediumint(9) NOT NULL ,
`throughTime`  datetime NOT NULL ,
`driveDirection`  tinyint(4) NOT NULL ,
`dataValid`  tinyint(4) NOT NULL ,
`dayOfMonth`  tinyint(4) NULL DEFAULT NULL ,
`zoneOfDay`  smallint(6) NULL DEFAULT NULL ,
`tripState`  tinyint(4) NULL DEFAULT NULL ,
PRIMARY KEY (`id`)
)
;

Jun.21,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36a97-2b7ab.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36a97-2b7ab.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?