title: MySQL ON UPDATE trigger - update the same table with CURRENT_TIMESTAMP and condition
body: <p><br>
  I have a MySQL(5.1.67) table '<strong>tracker</strong>' with TIMESTAMP field '<strong>close_time</strong>'.<br>
  In the same table I have string field '<strong>status</strong>'.<br>
  I want to update <strong>close_time</strong> field with CURRENT_TIMESTAMP value when <strong>status</strong> field updated to specific text value, for example '<em>Closed</em>'.</p>
  
  <p>Here is sample with INSERT:
  <a href="https://stackoverflow.com/questions/20079686/how-can-i-write-a-trigger-that-updates-rows-in-the-same-table-before-the-insert">How can I write a trigger that updates rows in the same table, before the insert is commited?</a></p>
  
  <p>I tried something like that:</p>
  
  <pre><code>CREATE TRIGGER `close_time_trigger` BEFORE UPDATE ON `tracker` FOR EACH ROW
        BEGIN
       IF NEW.status = 'Closed' THEN
       SET NEW.close_time = CURRENT_TIMESTAMP;     
       END IF;
       END
  </code></pre>
  
  <p>But I got error: You have an error in your SQL syntax ... at line 4. <br></p>
  
  <p>I tried some other variations which I found but none of them works.
  Please help to create correct trigger for my case.</p>