UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Att0pdEhk1LPSMSxohpCprl75O8tzQ/5j8z7LYR0Qbc=' 
WHERE 
  key_id = '164a70a4bd817c926f72f7539365e01b259b478d44d6cd54125c91f16c76e323' 
  AND (
    token = 'Att0pdEhk1LPSMSxohpCprl75O8tzQ/5j8z7LYR0Qbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044