UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ew86ArcAIRHwVS2qLUkLXXAIFnnpUOwoB+3O8Oakmzk=' 
WHERE 
  key_id = '8a0bde1c5631ddb33ab2d90b400d280218b399d73b2aab8a564bd26a58f04df6' 
  AND (
    token = 'Ew86ArcAIRHwVS2qLUkLXXAIFnnpUOwoB+3O8Oakmzk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030