UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hGj9FxVRL+NsSUEN7RCrT152hOhaYiz06ij16pos8w8=' 
WHERE 
  key_id = '0948c23e176450b227d5d06bfbac651453f0db9369f2984c8ae39da2873ad709' 
  AND (
    token = 'hGj9FxVRL+NsSUEN7RCrT152hOhaYiz06ij16pos8w8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039