Mysql select for update according to the secondary index, how to lock when the record can not be queried?

Table structure

CREATE TABLE `table1` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT "id",
  `account_name` varchar(65) NOT NULL COMMENT ,
  PRIMARY KEY (`id`),
  KEY `idx_an` (`account_name`,`already_login`),
) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8;
select * from table1 where name="1"  for update;

how is it locked when there is no such data in the table?

Mar.13,2021
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-1e93d07-1487.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-1e93d07-1487.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?