UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DoSLCoA09oFMW+yfOAQPsrUZZRyf/48tWojq8/ZYt2A=' 
WHERE 
  key_id = '700736dc729d26683f6a03eb3e817a333d7cd5787568747588e0816137c1c4ac' 
  AND (
    token = 'DoSLCoA09oFMW+yfOAQPsrUZZRyf/48tWojq8/ZYt2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023