UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '10gs9DRTxDCOEy4M4DTBm6N2JcgLtdJcA1K/mcMe5ng=' 
WHERE 
  key_id = '3a03c16f024d7a4f8dec88a6509c00c75c3f162c3a4557086b1ed11c14d90d13' 
  AND (
    token = '10gs9DRTxDCOEy4M4DTBm6N2JcgLtdJcA1K/mcMe5ng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035