UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'abCjjqDv7gH51sPlZ9pm/SbM4NHNNdkXdcYtOHj79l0=' 
WHERE 
  key_id = 'a2f92c618049bc4585541a10f20b35cf63550093002f444dae70b4602269b01f' 
  AND (
    token = 'abCjjqDv7gH51sPlZ9pm/SbM4NHNNdkXdcYtOHj79l0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032