title: PHP - MYSQL - insert on duplicate key AND(?)
body: <p>Is it possible to connect the duplicate key to another statement.
  I just picked some integers <code>(4=4)</code> for the example. In the actuall code I am trying to compare two dates and only if the date in the database row is bigger than the php generated date AND duplicated key it should update <code>unj</code> to <code>7</code>.</p>
  
  <p>from this:</p>
  
  <pre><code>$sql="INSERT INTO mutable (hid, xsn, unj, for, datetime)
  VALUES ('$hid', '$xsn', '$unj', '$for', now()) ON DUPLICATE KEY UPDATE unj=7";
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code> $sql="INSERT INTO mutable (hid, xsn, unj, for, datetime)
  VALUES ('$hid', '$xsn', '$unj', '$for', now()) ON 4=4 AND DUPLICATE KEY UPDATE unj=7";
  </code></pre>
  
  <p>( <strong>ON 4=4 AND</strong> ) added.</p>
  
  <p>But this is not working. Is there any way to archive this?</p>
  
  <p>Thank you.</p>
  
  <p><strong>edit</strong>: I know I could archive this with using SELECT and then INPUT or UPDATE but I need more efficient code.</p>