UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lH8wZyR15JBnchu9sgoe5A4YwqtdfN6edYphuXysl6E=' 
WHERE 
  key_id = '38cac2b8e59a7565352bb297894481e443155c9ac2a43391bdd651b1dcb0b813' 
  AND (
    token = 'lH8wZyR15JBnchu9sgoe5A4YwqtdfN6edYphuXysl6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029