title: Unable to create WHERE clause to update
body: <p>I am trying to create a WHERE clause that only allow 1 hour before NOW() TO 4 hours after NOW() and between 7am to 8pm. The attribute I am trying to update is date_time TIME type.</p>
  
  <pre><code>UPDATE lot
  SET userid = 'UID00001', 
      lot_status = 'reserved', 
      date_time = '2017-11-20 19:30:00'
  WHERE carparkid = 'CID00001' 
    AND lot_num = 1 
    AND lot_status = 'empty' 
    AND (date_time BETWEEN DATE_SUB(NOW(), INTERVAL 1 HOUR) 
                       AND DATE_ADD(NOW(), INTERVAL 4 HOUR) 
         OR (DATE_FORMAT(date_time, '%k:%i:%s') BETWEEN '07:00:00' 
                                                    AND '20:00:00')
        );
  </code></pre>
  
  <p>I tried many other ways but still cannot insert in my tuple. I inserted according my current time.</p>
  
  <p>My current timing is 10:48</p>
  
  <pre><code>MariaDB [carparkful]&gt; UPDATE lot
      -&gt; SET userid = 'UID00001', lot_status = 'reserved', date_time = '2017-11-21 10:30:00'
      -&gt; WHERE carparkid = 'CID00001' AND lot_num = 1 AND lot_status = 'empty' AND (date_time BETWEEN  DATE_SUB(NOW(), INTERVAL 1 HOUR) AND DATE_ADD(NOW(), INTERVAL 4 HOUR)
      -&gt; OR (DATE_FORMAT(date_time, '%k:%i:%s') BETWEEN '07:00:00' AND '20:00:00'));
  Query OK, 0 rows affected (0.00 sec)
  Rows matched: 0  Changed: 0  Warnings: 0
  
  MariaDB [carparkful]&gt; UPDATE lot
      -&gt; SET userid = 'UID00001', lot_status = 'reserved', date_time = '2017-11-21 10:30:00'
      -&gt; WHERE carparkid = 'CID00001' AND lot_num = 1 AND lot_status = 'empty' AND (date_time BETWEEN  DATE_SUB(NOW(), INTERVAL 1 HOUR) AND DATE_ADD(NOW(), INTERVAL 4 HOUR)
      -&gt; AND (DATE_FORMAT(date_time, '%k:%i:%s') BETWEEN '07:00:00' AND '20:00:00'));
  Query OK, 0 rows affected (0.00 sec)
  Rows matched: 0  Changed: 0  Warnings: 0
  
  CREATE TABLE lot
  (carparkid VARCHAR(10) NOT NULL, userid VARCHAR(10), lot_num INT(3) NOT NULL, lot_status ENUM('empty', 'reserved', 'occupied') DEFAULT 'empty', date_time DATETIME);
  
  MariaDB [carparkful]&gt; select*from lot;
  +-----------+--------+---------+------------+-----------+
  | carparkid | userid | lot_num | lot_status | date_time |
  +-----------+--------+---------+------------+-----------+
  | CID00001  | NULL   |       1 | empty      | NULL      |
  | CID00001  | NULL   |       2 | empty      | NULL      |
  | CID00001  | NULL   |       3 | empty      | NULL      |
  | CID00001  | NULL   |       4 | empty      | NULL      |
  | CID00001  | NULL   |       5 | empty      | NULL      |
  | CID00002  | NULL   |       1 | empty      | NULL      |
  | CID00002  | NULL   |       2 | empty      | NULL      |
  | CID00002  | NULL   |       3 | empty      | NULL      |
  | CID00002  | NULL   |       4 | empty      | NULL      |
  | CID00002  | NULL   |       5 | empty      | NULL      |
  | CID00003  | NULL   |       1 | empty      | NULL      |
  | CID00003  | NULL   |       2 | empty      | NULL      |
  | CID00003  | NULL   |       3 | empty      | NULL      |
  | CID00003  | NULL   |       4 | empty      | NULL      |
  | CID00003  | NULL   |       5 | empty      | NULL      |
  .........
  </code></pre>