title: MySQL - Change field value after X minutes of inactivity
body: <p>I am trying to find a way to have a cronjob which checks how long it has passed since the last update of a row, if it is more than X, then change field 'ACTIVE' to 'FALSE'.</p>
  
  <p>I have a robot which updates its current IP and add the timestamp. </p>
  
  <p>From the other side, there might be a User willing to send commands to the robot. My idea is to be able to tell whether the robot has been active in the last X seconds and therefore it makes sense trying to send a command to it.</p>
  
  <p>So, I guess some sort of script which checks if current_time() - field_time >= X then changeValue('ACTIVE')&lt;- False.</p>
  
  <p>Can this be done directly on the DB every X seconds? Or perhaps using a script in PHP a better way to handle this problem? (a script which loops indefinitely)</p>