UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mhw+VefQChvqSCb8Rr7CnAahV5R6YQoMyxeo0u1N9HQ=' 
WHERE 
  key_id = '96d8b46d392bdb13e5e8a10e60b70f4182ae765aacd29a0f9dd81f886f24b7e7' 
  AND (
    token = 'mhw+VefQChvqSCb8Rr7CnAahV5R6YQoMyxeo0u1N9HQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033