The keep-alive interval tells the client how often it must send a message (like a ping) to the broker to show it is still connected. This helps the broker detect if the client has disconnected unexpectedly.
Client client123 timed out, disconnecting
This log means the broker did not receive any message from the client within the expected keep-alive timeout period, so it disconnected the client assuming it is offline.
The correct syntax in mosquitto.conf to set the maximum keep-alive interval is max_keepalive 120. Other options are invalid or do not exist.
A keep-alive timeout error means the client did not send any message within the expected interval. Other causes would produce different errors.
The broker first waits for a message within the keep-alive interval (1). If none arrives within 1.5 times that interval, it detects a timeout (2). Then it sends a disconnect message to the client (3). Finally, it closes the client connection and frees resources (4).